<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>PetStore UOC - Practical Case</title>
</h:head>

<ui:composition template="./headerView.xhtml">
	<ui:define name="content">
		<br/>
			
			<h:form rendered="#{!empty customerLogin.dataCustomer.name}">
		 	      
		    <p><b><font face="geneva,verdana,arial" size="4">Client Edition:</font></b>
		    </p>
		    <table>
				
				<tr>
					<td align="right">Client NIF:</td>
					<td align="left"><input type="text"   maxlength="9" name="nifCustomer" size="10" value="#{customerLogin.dataCustomer.nif}"/></td>
				</tr>
				
		        <tr>
					<td align="right">Client Email:</td>
					<td align="left"><input type="text"  maxlength="30" name="emailCustomer" size="31" value="#{customerLogin.dataCustomer.email}"/></td>
				</tr>
				
				<tr>
					<td align="right">Client Name:</td>
					<td align="left"><input type="text"  maxlength="30" name="nameCustomer" size="31" value="#{customerLogin.dataCustomer.name}"/></td>
				</tr>
				
		        <tr>
					<td align="right">Client Surname:</td>
					<td align="left"><input type="text"   maxlength="30" name="surnameCustomer" size="31" value="#{customerLogin.dataCustomer.surname}"/></td>
				</tr>
		        
		         <tr>
					<td align="right">Client BirthDate (yyyy-mm-dd):</td>
					<td align="left"><input type="text"  maxlength="10" name="birthdateCustomer" size="11" value="#{customerLogin.dataCustomer.birthdate}" /></td>
				</tr>
				
				<tr>
					<td align="right">Password:</td>
					<td align="left"><h:link outcome="changePasswordView" value="Change password"/></td>
				</tr>
		    </table>
		             
		          <p align="left">
		        	<h:commandButton value="Modify" immediate="true" action="#{modifyClient.modifyClientMBean}">		
		                 <f:param name="nifCustomer" value="nifCustomer"></f:param>
		                 <f:param name="emailCustomer" value="emailCustomer"></f:param>
		                 <f:param name="nameCustomer" value="nameCustomer"></f:param>
		                 <f:param name="surnameCustomer" value="surnameCustomer"></f:param> 
		                 <f:param name="birthdateCustomer" value="birthdateCustomer"></f:param>
		        	</h:commandButton>
		          </p>
		          <br/><br/>
					<h:commandButton value="Back" immediate="true" action="#{modifyClient.clientDetail}" />
		                      
			</h:form>
			
			
			<h:form rendered="#{empty customerLogin.dataCustomer.name}">
		 	      
		    <p><b><font face="geneva,verdana,arial" size="4">New client:</font></b>
		    </p>
			 	<h:outputText value="NIF:"/>
			 	<h:inputText name="nifCustomer" value="#{customerRegister.dataCustomer.nif}" required="true"/>
			 	<br />
			 	<h:outputText value="E-mail:"/>
			 	<h:inputText id="emailCustomer" value="#{customerRegister.dataCustomer.email}" required="true"/>
			 	<br />
			 	<h:outputText value="Password:"/>
			 	<h:inputSecret id="passwordCustomer" value="#{customerRegister.dataCustomer.password}" required="true"/>
			 	<br />
			 	<h:outputText value="Repeat password:"/>
			 	<h:inputSecret id="passwordRepeated" value="#{customerRegister.pwd2}" required="true"/>
			 	<br />
			 	<h:outputText value="Name:"/>
			 	<h:inputText id="nameCustomer" value="#{customerRegister.dataCustomer.name}" required="true"/>
			 	<br />
			 	<h:outputText value="Surname:"/>
			 	<h:inputText id="surnameCustomer" value="#{customerRegister.dataCustomer.surname}" required="true"/>
			 	<br />
			 	<h:outputText value="Birthdate (yyyy-mm-dd):"/>
			 	<h:inputText id="birthdateCustomer" value="#{customerRegister.date}" required="true"/>
			 	<br />
			 	<h:commandButton value="Register" action="#{customerRegister.addClientMBean}"/>
			 	
		        <br/><br/><br/>
				<h:commandButton value="Back" immediate="true" action="#{customerRegister.index}" />

		  </h:form>
	</ui:define>
</ui:composition>
</html>
